
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
	<title>可用可信家庭市场</title>
	<!--                       CSS                       -->
	<!-- Reset Stylesheet -->
	<link rel="stylesheet" href="/static/css/reset.css" type="text/css" media="screen" />
	<!-- Main Stylesheet -->
	<link rel="stylesheet" href="/static/css/style.css" type="text/css" media="screen" />
	<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
	<link rel="stylesheet" href="/static/css/invalid.css" type="text/css" media="screen" />
	<!--                       Javascripts                       -->
	<!-- jQuery -->
	<script type="text/javascript" src="/static/scripts/jquery-1.3.2.min.js"></script>
	<!-- jQuery Configuration -->
	<script type="text/javascript" src="/static/scripts/simpla.jquery.configuration.js"></script>
	<!-- Facebox jQuery Plugin -->
	<script type="text/javascript" src="/static/scripts/facebox.js"></script>
	<!-- jQuery WYSIWYG Plugin -->
	<script type="text/javascript" src="/static/scripts/jquery.wysiwyg.js"></script>

	<link rel="stylesheet" type="text/css" media="all" href="/static/css/motai.css">
	<script type="text/javascript" charset="utf-8" src="/static/js/jquery.leanModal.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.js" ></script>
<script type="text/javascript" src="/static/js/jquery.form.js"></script>

	<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>	


	<style>
		.modal-open .modal {
    overflow-x: hidden;
    overflow-y: auto;
}

.modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1050;
    display: none;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    outline: 0;
}
.fade {
    opacity: 0;
    -webkit-transition: opacity .15s linear;
    -o-transition: opacity .15s linear;
    transition: opacity .15s linear;
}
.modal-dialog {
    width: 600px;
    margin: 30px auto;
}

* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
		#update_table table{
			width:900px;
			height:1000px;
			border:1px;
			border-color:forestgreen;
		}
		.guige{
			float:left;
			line-height:40px;
			margin-left:20px;
			margin-bottom:10px;
			width:150px;
			height:40px;
			background-color:forestgreen;
			color:white;
		}
		.addguige{
			width:200px;
			height:35px;
			float:right;
			margin-left:20px;
			background-color:#9FB6CD;
			text-align:center;
		}
		.gweight{
			float:left;
			line-height:20px;
			margin-left:20px;
			margin-bottom:10px;
			width:200px;
			height:50px;
			background-color:cornflowerblue;
			color:white;
		}
		.jia{
			width:50px;
			height:50px;
			background-image:url(/static/images/jia.png);
		}
		</style>
<style type="text/css">
.btn{position: relative;overflow: hidden;margin-right: 4px;display:inline-block;*display:inline;padding:4px 10px 4px;font-size:14px;line-height:18px;*line-height:20px;color:#fff;text-align:center;vertical-align:middle;cursor:pointer;background-color:#5bb75b;border:1px solid #cccccc;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
.btn input {position: absolute;top: 0; right: 0;margin: 0;border: solid transparent;opacity: 0;filter:alpha(opacity=0); cursor: pointer;}
.progress { position:relative; margin-left:100px; margin-top:-24px; width:200px;padding: 1px; border-radius:3px; display:none}
.bar {background-color: green; display:block; width:0%; height:20px; border-radius: 3px; }
.percent { position:absolute; height:20px; display:inline-block; top:3px; left:2%; color:#fff }
.files{height:22px; line-height:22px; margin:10px 0}
.delimg{margin-left:20px; color:#090; cursor:pointer}
</style>
	
	<style type="text/css">
.demo1{width:760px;}
.preview1{width:200px;border:solid 1px #dedede; margin:10px;padding:10px;}
.demo1 p{line-height:26px}
.btn1{position: relative;overflow: hidden;margin-right: 4px;display:inline-block;*display:inline;
padding:4px 10px 4px;font-size:14px;line-height:18px;*line-height:20px;color:#fff;text-align:center;
vertical-align:middle;cursor:pointer;background-color:#5bb75b;border:1px solid #cccccc;border-color:#e6e6e6 #e6e6e6 #bfbfbf;
border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
.btn1 input {position: absolute;top: 0; right: 0;margin: 0;border: solid transparent;opacity: 0;filter:alpha(opacity=0); cursor: pointer;}
</style>
<!--多图上传js-->
<script type="text/javascript" src="/static/js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="/static/js/jquery.wallform.js"></script>

</head>
<body>
<div id="body-wrapper">
	<!-- Wrapper for the radial gradient background -->
	<div id="sidebar">
		<div id="sidebar-wrapper">

			<div id="profile-links">
				<!-- Logo (221px wide) -->
				<a href="#"><img id="logo" src="/static/images/logo.png" alt="Simpla Admin logo" /></a>

				{$_COOKIE['user_name']},你好 <br/>
				| <a href="/index.php/index/index/uexit" title="Sign Out">退出</a> </div>

			 <ul id="main-nav">
                <!-- Accordion Menu -->
                <!--<li> <a href="#/" class="nav-top-item no-submenu">-->
                    <!--&lt;!&ndash; Add the class "no-submenu" to menu items with no sub menu &ndash;&gt;-->
                    <!--Dashboard </a> </li>-->
                {if condition="!empty($powers['order_action'])"}
                <li> <a href="#" class="nav-top-item"> 订单操作</a>
                    <ul>
                    	
                        <li><a href="/index.php/index/index/neworder_list">新订单</a></li>
                        <!-- Add class "current" to sub menu items also -->
                        <li><a href="/index.php/index/index/addorder">创建新订单</a></li>
                        <li><a href="/index.php/index/index/allorder_list">所有订单</a></li>
                    </ul>
                </li>
           	{/if}
           	 {if condition="!empty($powers['cg_action'])"}
                <li> <a href="#" class="nav-top-item"> 采购单 </a>
                    <ul>
                        <li><a href="/index.php/index/index/newcg_list">待处理 采购单</a></li>
                        <li><a href="/index.php/index/index/cg_history">采购单历史</a></li>
                    </ul>
                </li>
             {/if}
              {if condition="!empty($powers['table_action'])"}
                <li> <a href="#" class="nav-top-item"> 报表 </a>
                    <ul>
                        <li><a href="/index.php/index/biao/daybiao">日报表</a></li>
                        <li><a href="/index.php/index/biao/yuebiao">月报表</a></li>
                        <li><a href="/index.php/index/biao/nianbiao">年报表</a></li>
                    </ul>
                </li>
               {/if}
                {if condition="!empty($powers['goods_action'])"}
                <li> <a href="#" class="nav-top-item  current">菜品管理 </a>
                    <ul>
                        <li><a class="current" href="/index.php/index/goods/goods">所有菜品</a></li>
                        <li><a href="/index.php/index/goods/categorys">所有分类</a></li>
                    </ul>
                </li>
                {/if}
                 {if condition="!empty($powers['promotion_action'])"}
                 <li> <a href="#" class="nav-top-item"> 推广活动 </a>
                    <ul>
                        <li><a href="/index.php/index/promotion/snlist">SN优惠码</a></li>
                    </ul>
                </li>
                {/if}
                <li> <a href="#" class="nav-top-item"> 个人信息 </a>
                    <ul>
                        <li><a href="/index.php/index/index/user_info">查看信息</a></li>
                        <li><a href="/index.php/index/index/update_pass">修改密码</a></li>
                    </ul>
                </li>
       
                {if condition="!empty($powers['super'])"}
                 <li><a href="#" class="nav-top-item"> 用户管理 </a>
                 	<ul>
                        <li><a href="/index.php/index/admin/user_admin">用户权限</a></li>
                    </ul>
                 </li>
                {/if}

            </ul>
            <!-- End #main-nav -->
		</div>
	</div>
	<!-- End #sidebar -->
	<div id="main-content">
		<!-- Main Content Section with everything -->

		<div class="content-box">

			<!-- Start Content Box -->
			<div class="content-box-header" style="height:20px;">
				<h5><a href="javascript:history.back()"> 《返回&nbsp;&nbsp;&nbsp;&nbsp; </a>修改菜品</h5>
			</div>
			<!-- End .content-box-header -->
			<div class="content-box-content">
					<form enctype="multipart/form-data" class="form-horizontal" method="post" action="/index.php/index/goods/goods_update2">
						<input type='hidden' value='{$goods.goods_id}' name='goods_id'>
						<table class="table1" style="line-height:40px;font-size:16px;width:1000px;">
							<tr>
								<td width="100px">名称：</td><td><input type="text" name="name" value="{$goods.name}"/></td>
							</tr>
							<tr>
								<td width="100px">单位：</td><td><input type="text" name="unit" value="{$goods.unit}"/></td>
							</tr>
							<tr>
								<td width="100px">原价：</td><td><input type="text" name="old_price" value="{$goods.old_price}"/></td>
							</tr>
							<tr>
								<td width="100px">现价：</td><td><input type="text" name="price" value="{$goods.price}"/></td>
							</tr>
							<tr>
								<td width="100px">会员价：</td><td><input type="text" name="vip_price" value="{$goods.vip_price}"/></td>
							</tr>
							<tr>
								<td width="100px">餐盒费：</td><td><input type="text" name="tools_price" value="{$goods.tools_price}"/></td>
							</tr>
							<tr>
								<td>主图:</td>
								<td>
									<div class="demo1">
											<div id="up_btn1" class="btn1">
												<span>添加图片</span><p id="pp"></p>
												<input id="photoimg1" type="file" name="photoimg1">
												<input  type="hidden" name="old_pic" value="{$goods.old_img}">
											</div>
										
								        <p>主图， 最多上传10个图片！支持jpg，gif，png格式。</p>
										<div id="preview1"></div>
			  						</div>
			  						
									{volist name="goods['pic']" id="vo"}
								<li style="float:left;list-style:none;line-height:20px;">	
									<img src="http://www.kykxmk.com{$vo.url}" class="preview1"/>
									<input type="hidden" name="pic[]" value="{$vo.title}"/><br/>
									<span class='delimg' rel="{$vo.url}">删除</span>
								</li>	
									{/volist}
								</td>
								
							</tr>
							<script type="text/javascript">
									$(function(){
										$(".demo1").wrap("<form id='myupload1' action='/index.php/index/goods/ajax_upload_picmore' method='post' enctype='multipart/form-data'></form>");  
										$('#photoimg1').die('click').live('change', function(){
											var btn = $("#up_btn1");
											
											$("#myupload1").ajaxForm({
												target: '#preview1', 
												success:function(){
													btn.show();
												
												}, 
												error:function(){
													btn.show();
													
											} }).submit();
										});
									});
							</script>
							<tr>
								<td width="100px">可见度：</td>
								<td>
						
									<label style="float:left;"><input type="radio" value="0" name="newuser" {if condition="$goods.newuser eq 0"}checked{/if} />所有人</label>　
									　<label style="float:left; margin-left:50px;"><input type="radio" value="1" name="newuser" {if condition="$goods.newuser eq 1"}checked{/if} />仅新用户可见</label>
								</td>
							</tr>
							<tr>
								<td width="100px">每日限量：</td><td><input type="text" name="limit" value="{$goods.limit}"/></td>
							</tr>
							<tr>
								<td width="100px">描述：</td>
								<td style="vertical-align:bottom;">
									<textarea name="desc" rows="5">{$goods.desc}</textarea>
								</td>	
							</tr>
							<tr>
								<td width="100px">选择分类：</td>
								<td >
									{volist name="categorys" id="ca"}
										<input type='radio' value="{$ca.gcat_id}" name="gcat_id" 
										{if condition=" $goods.gcat_id eq $ca.gcat_id || !$goods.gcat_id"}checked{/if} jstips='请添加商品分类'> {$ca.gcat_name} &nbsp;

									{/volist}
								</td>
							</tr>
							<tr>
								<td>规格</td>
								<td style="vertical-align:bottom;" class="form-group">
									{if condition="$goods['gjson']"}
											{volist name="goods['gjson']" id="gj"}
												<div class="guige">
													<a href="#" class="close" data-dismiss="alert">×</a>
													&nbsp;&nbsp;{$gj[0]}
													<input type="hidden" name="g_name[]" value="{$gj[0]}">
													<input size="4" type="text" name="g_price[]" value="{$gj[1]}">元
												</div>
											{/volist}
									{/if}
								<div class="addguige"><!--onclick="addguige({$goods.goods_id})"-->
										    <input class="col-sm-1 variety unit1" size="8" type="text" value="" placeholder="名称"/>
										    <input class="col-sm-1 variety unit2" size="4" type="text" value=""  placeholder="价钱"/>元
										    <button type="button" gdata="g_name" price="g_price" dw="元" class="gadd btn btn-default" style="background-color:#BCD2EE;margin-bottom:5px;">+</button>
									
								</div>
								</td>
							</tr>
							
							<tr>
								<td>重量选项</td>
								<td style="vertical-align:bottom;" class="form-group">
									{if condition="$goods['gweight']"}
											{volist name="goods['gweight']" id="gj"}
												<div class="guige">
													<a href="#" class="close" data-dismiss="alert">×</a>
													&nbsp;&nbsp;{$gj[0]}
													<input type="hidden" name="weight[]" value="{$gj[0]}">
													<input size="4" type="text" name="weight_g[]" value="{$gj[1]}">{$goods.unit}
												</div>
											{/volist}
									{/if}
								<div class="addguige">
										<input class="col-sm-1 variety unit1" size="8" type="text" value="/斤" placeholder="重量/斤"/>
										<input class="col-sm-1 variety unit2" size="4" type="text" value="" placeholder=""/>克
										<button type="button" gdata="weight" price="weight_g" dw="克" class="gadd btn btn-default" style="background-color:#BCD2EE;margin-bottom:5px;">+</button>
								</div>
									
								</td>
							</tr>
								<script>
									$(function(){
										//规格属性添加输入框
										$('.gadd').click(function(){
											vval=$(this).parents('.addguige').find('.unit1').val();
											vval2=$(this).parents('.addguige').find('.unit2').val();
											gdata=$(this).attr('gdata');//表单项名
											price=$(this).attr('price');//价钱
											dw=$(this).attr('dw');//单位
											
											$(this).parents('.addguige').before('<div class="guige"><a href="#" class="close" data-dismiss="alert">×</a>&nbsp;&nbsp;'+vval+'<input type="hidden" name="'+gdata+'[]" value="'+vval+'"><input size="4" type="text" name="'+price+'[]" value="'+vval2+'" >'+dw+'</div>');
									
										});
									});
								</script>
								<!--won规格结束-->
							
							<tr>
								<td>排序</td><td><input type="text" name="sort" value="{$goods.sort}"/></td>
							</tr>
							<tr>
								<td>状态</td>
								<td>
									<label style="float:left;"><input type="radio" value="1" name="status" {if condition="$goods.status eq 1"}checked{/if} />开启</label>　
									　<label style="float:left; margin-left:50px;"><input type="radio" value="0" name="status" {if condition="$goods.status eq 0"}checked{/if} />关闭</label>
								</td>
							</tr>
						
							<tr>
								<td>商品缩略图</td>
								<td>
									<div class="demo">  
								        <div class="btn">  
								            <span>上传图片</span>   
								            <input id="fileupload" type="file" name="mypic">  
								            <input  type="hidden" name="old_img" value="{$goods.old_img}">  
								        </div>  
								        <p>列表页面显示的图片！最多上传1个图片！图片宽度建议为50px，高度建议为50px。
								        </p>  
								        <div class="files"></div>  
								        <div id="showimg"><img src="http://www.kykxmk.com{$goods.list_pic.s_image}"/></div>  
									</div>  
									
								</td>
							</tr>
							
							
							
							<!--<tr>
								<td>商品缩略图片</td>
								<td>
									<img src="{$goods.list_pic.s_image}"/>
												<input type="hidden" name="upimg" value="{$goods.list_pic.s_image}"/>
												
									<input type= "file" name ="img" class= "file" value ="" />
<input type="hidden" name ="pic" class= "file" value ="upload/small_img/s_hello.jpg" />
     <input type= "submit" name ="uploadimg" value= "上传" />
									
								
												<a href="#" onclick="deleteupImage('{$goods.list_pic.s_image}',this);return false;">[ 删除 ]</a>
									</div>
									<span class="form_tips">列表页面显示的图片！最多上传1个图片！图片宽度建议为50px，高度建议为50px。</span>
								</td>
							</tr>-->

						</table>
						
							
							
							

						
						
						<label style="font-size:18px;margin-top:10px;">商品详情</label>
						<textarea name="content" style="width:1000px;height:800px;visibility:hidden;"></textarea>
						
		




					</form>	

			</div>
			<!-- End .content-box-content -->
		</div>
		<!-- End .content-box -->



	</div>
	<!-- End #main-content -->
</div>
<script type="text/javascript">  
$(function () {  
 
    var showimg = $('#showimg');    
    var files = $(".files");  
    var btn = $(".btn span");  
    $(".demo").wrap("<form id='myupload' action='/index.php/index/goods/ajax_upload_pic' method='post' enctype='multipart/form-data'></form>");  
    $("#fileupload").change(function(){  
        $("#myupload").ajaxSubmit({  
            dataType:  'json',  
            success: function(data) {  
                alert(data);
            },  
            error:function(xhr){  
                btn.html("上传失败");  
                bar.width('0')  
                files.html(xhr.responseText); 
                alert(xhr);
            }  
        });  
    });  
      
    $(".delimg").live('click',function(){  
        var pic = $(this).attr("rel");  
        $.post("/index.php/index/goods/ajax_del_pic",{imagename:pic},function(msg){  
            if(msg==1){  
                files.html("删除成功.");  
                showimg.empty();  
                progress.hide();  
            }else{  
                alert(msg);  
            }  
        });  
    });  
});  

function addguige(id){
	$('#addguige').val(id);
}
</script>


<link rel="stylesheet" href="/kindeditor/themes/default/default.css" />
	<link rel="stylesheet" href="/kindeditor/plugins/code/prettify.css" />
	<script charset="utf-8" src="/kindeditor/kindeditor.js"></script>
	<script charset="utf-8" src="/kindeditor/lang/zh_CN.js"></script>
	<script charset="utf-8" src="/kindeditor/plugins/code/prettify.js"></script>
	
	
	<script>
	
	
KindEditor.ready(function(K){
	var editor = K.create('textarea[name="content"]', {
       allowFileManager : true
	});
editor.insertHtml('{$goods.gbody}');

	K('#J_selectImage').click(function(){
		if($('.upload_pic_li').size() >= 10){
			alert('最多上传10个图片！');
			return false;
		}
		editor.uploadJson = "/index.php/index/goods/ajax_upload_pic";
		editor.loadPlugin('image', function(){
			editor.plugin.imageDialog({
				showRemote : false,
				imageUrl : K('#course_pic').val(),
				clickFn : function(url, title, width, height, border, align) {
					$('#upload_pic_ul').append('<li class="upload_pic_li"><img src="http://www.kykxmk.com'+url+'"/><input type="hidden" name="pic[]" value="'+title+'"/><br/><a href="#" onclick="deleteImage(\''+title+'\',this);return false;">[ 删除 ]</a></li>');
					editor.hideDialog();
				}
			});
		});
	});
	K('#upImage').click(function(){
		if($('.upimgli').size() >= 1){
			alert('最多上传1个图片！');
			return false;
		}
		editor.uploadJson = "/index.php/index/goods/ajax_upload_pic";
		editor.loadPlugin('image', function(){
			editor.plugin.imageDialog({
				showRemote : false,
				imageUrl : K('#course_pic').val(),
				clickFn : function(url, title, width, height, border, align) {
					$('.upimg').append('<div class="upimgli"><img src="http://www.kykxmk.com'+url+'"/><input type="hidden" name="upimg" value="'+title+'"/><br/><a href="#" onclick="deleteupImage(\''+title+'\',this);return false;">[ 删除 ]</a></div>');
					editor.hideDialog();
				}
			});
		});
	});
	
});

function deleteupImage(path,obj){
	$.post("{/index.php/index/goods/ajax_del_pic')}",{path:path});
	$(obj).closest('.upimgli').remove();
}
	</script>

<script>

</script>


</body>
</html>
